/**
 * @(#) SimpleUnitDefinitionBuilder.java
 */

package org.vsg.stock.core.indicator.coordinate;

import java.text.DecimalFormat;

public class SimpleUnitDefinitionBuilder implements UnitDefinitionBuilder{
	/**
	 * @param originPoint
	 * @return 
	 */
	@Override
	public UnitDefinition build(OriginalDataPoint originPoint) {
		
		double yvalue = originPoint.getYvalue();
		
		double unitValue = yvalue / 100;
		
		DecimalFormat df = new DecimalFormat("0.0000");
		
		double yUnitValue = Double.parseDouble( df.format( unitValue )  );
		
		SimpleUnitDefinition sud = new SimpleUnitDefinition();
		sud.setXUnit( 1 );
		sud.setYUnit( yUnitValue );
		
		
		return sud;
	}
	
	
}
